<template>
  <div class="all">
    <div>
      <el-button type="primary" icon="el-icon-download" @click="exportExcel">导出</el-button>
    </div>
      <div style="padding: 5px 0;">
        <el-table :data="list" :header-cell-style="{background:'#eef3f7'}">
          <el-table-column align="center" prop="nickName" label="昵称"></el-table-column>
          <el-table-column align="center" prop="userName" label="用户名"></el-table-column>
          <el-table-column align="center" prop="balance" label="可提现总余额"></el-table-column>
          <el-table-column align="center" prop="tixian" label="提现金额"></el-table-column>
          <el-table-column align="center" prop="tixianType" label="提现方式"></el-table-column>
          <el-table-column align="center" prop="cardNum" label="提现卡号"></el-table-column>
          <el-table-column align="center" prop="realName" label="持卡人姓名"></el-table-column>
          <el-table-column align="center" prop="bank" label="开户行"></el-table-column>
          <el-table-column align="center" label="操作">
            <template slot-scope="scope">
              <el-button></el-button>
            </template>
          </el-table-column>
        </el-table>
        <div class="Page">
              <el-pagination
              background
              hide-on-single-page

                @current-change="handleCurrentChange"
                :current-page="condition.pageIndex"
                :page-size="condition.pageSize"
                layout="total, prev, pager, next, jumper"
                :total="condition.quantity">
              </el-pagination>

        </div>
      </div>
  </div>
<!--  <Table :header="header" :list="list" :quantity="quantity"
  @Postdata="Postdata"
  @Submit="Submit"
  ></Table> -->

</template>

<script>
  import Blob from '@/Expcel/Blob'
  import Export2Excel from '@/Expcel/Export2Excel.js'
  import Cookies from 'js-cookie'
 export default {
   data(){
     return{
   condition:{
     pageIndex:1,
     pageSize:15,
     quantity:0,
   },
        list:[],
        admin:{
          adminName:Cookies.get('adminName'),
          token:Cookies.get('token')
        },
     }
   },
   methods:{
     //导出
     exportExcel() {
           require.ensure([], () => {
             const { export_json_to_excel } = require('@/Expcel/Export2Excel');
             const tHeader = ['用户昵称', '用户名', '可提现总余额','提现金额','提现方式','提现卡号','持卡人姓名','开户行'];
             // 上面设置Excel的表格第一行的标题
             const filterVal = ['nickName', 'userName', 'balance','tixian','tixianType','cardNum','realName','bank'];
             // 上面的index、nickName、name是tableData里对象的属性
             const list = this.list;  //把data里的tableData存到list
             const data = this.formatJson(filterVal, list);
             export_json_to_excel(tHeader, data, '列表excel');
           })
         },
         formatJson(filterVal, jsonData) {
           return jsonData.map(v => filterVal.map(j => v[j]))
           },
     Postdata(e){
     console.log(e)
     },
     Submit(c){
       console.log(11111)
       console.log(c)
     }

   }
 }
</script>

<style>
</style>
